package model;

import view.drawable.ArcDrawable;

import java.awt.*;

/**
 * Created with IntelliJ IDEA.
 * User: Thomas
 * Date: 04/02/14
 * Time: 10:17
 * Classe permettant la gestion de tous les arcs du graph
 */
public class Arc {
    //Noeud de source de l'arc
    private Noeud source;
    //Noeud de destination de l'arc
    private Noeud destination;
    //Ligne de transport
    private String ligne;
    //Cout de l'arc
    private double cout;
    //Objet permettant la gestion graphique de l'arc
    private ArcDrawable arcDrawable;

    public Arc(Noeud source, Noeud destination, String ligne, double cout) {
        this.source = source;
        this.destination = destination;
        this.ligne = ligne;
        this.cout = cout;

        //Initialisation graphique de l'arc
        this.drawArc();
    }

    public ArcDrawable getArcDrawable() {
        return arcDrawable;
    }

    public void setArcDrawable(ArcDrawable arcDrawable) {
        this.arcDrawable = arcDrawable;
    }

    public void drawArc() {
        ArcDrawable arcDrawable = new ArcDrawable(new Point(0,0),new Dimension(0,0),this);
        this.setArcDrawable(arcDrawable);
    }

    public Noeud getSource() {
        return source;
    }

    public void setSource(Noeud source) {
        this.source = source;
    }

    public Noeud getDestination() {
        return destination;
    }

    public void setDestination(Noeud destination) {
        this.destination = destination;
    }

    public String getLigne() {
        return ligne;
    }

    public void setLigne(String ligne) {
        this.ligne = ligne;
    }

    public double getCout() {
        return cout;
    }

    public void setCout(double cout) {
        this.cout = cout;
    }

    @Override
    public String toString() {
        return "model.Arc{" +
                "source=" + source +
                ", destination=" + destination +
                ", ligne='" + ligne + '\'' +
                ", cout=" + cout +
                '}';
    }
}
